{
    const array1 = ['a', 'b', 'c'];
    // const iterator = array1.keys();
    const iterator = array1.values();

    let key1 = iterator.next().value  // => 0
    let key2 = iterator.next().value  // => 1

    for (const key in iterator) {
        console.log(key);
    }
    // Expected output:
    //

    for (const key of iterator) {
        console.log(key);
    }
    // Expected output:
    //  0
    //  1
    //  2
}

{
    const array1 = ['a', 'b', 'c'];

    const iterator1 = array1.entries();

    // console.log(iterator1.next().value);  // => [0, "a"]
    // console.log(iterator1.next().value);  // => [1, "b"]

    for (const key in iterator1) {
        console.log(key);
    }
    // Expected output:
    //

    for (const key of iterator1) {
        console.log(key);
    }
    // Expected output:
    //   [ 0, 'a' ]
    //   [ 1, 'b' ]
    //   [ 2, 'c' ]
}

{
    const arr = ['a', , 'c'];
    const sparseKeys = Object.keys(arr);
    const denseKeys = [...arr.keys()];
    console.log(sparseKeys); // ['0', '2']
    console.log(denseKeys); // [0, 1, 2]
}

{
    const arrayLike = {
        length: 3,
    };
    for (const entry of Array.prototype.keys.call(arrayLike)) {
        console.log(entry);
    }
    // 0
    // 1
    // 2
}